import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;

public class Test {
    public static void main1(String[] args) {
        SearchTree searchTree = new SearchTree();
        int[] array={10,4,29,35,18,27,5,13};
        for (int i = 0; i < array.length; i++) {
            searchTree.insert(array[i]);
        }
        System.out.print("查找:");
        SearchTree.TreeNode node=searchTree.search(18);
        try{
            System.out.println(node.key);
        }catch(NullPointerException e){
            System.out.println("没有查找的元素");
            e.printStackTrace();
        }
        searchTree.remove(10);
        System.out.println();

    }

    public static void main2(String[] args) {
        Set<String> set = new TreeSet<>();
        set.add("hello");
        set.add("world");
        System.out.println(set);
        Map<String,Integer> map=new TreeMap<>();
        map.put("age",20);
        map.put("tall",180);
        System.out.println(map);
        //打印所有的键值对
        for(Map.Entry<String,Integer> entry:map.entrySet()){
            System.out.println("key:"+entry.getKey()+"-->"+"val:"+entry.getValue());
        }
    }

    public static void main(String[] args) {
        HashBuck hashBuck1 = new HashBuck();
        hashBuck1.putFirst(1,99);//1
        hashBuck1.putFirst(4,99);//4
        hashBuck1.putFirst(36,99);//4
        hashBuck1.putFirst(5,99);//5
        hashBuck1.putFirst(7,99);//7
        //hashBuck1.putFirst(17,99);//1 超过载荷因子重新哈希
        System.out.println("");
        HashBuck hashBuck2 = new HashBuck();
        hashBuck2.putLast(1,99);//1
        hashBuck2.putLast(4,99);//4
        hashBuck2.putLast(36,99);//4
        hashBuck2.putLast(5,99);//5
        hashBuck2.putLast(7,99);//7
        hashBuck2.putLast(17,99);//1 超过载荷因子重新哈希
        System.out.println("");

    }

}
